package com.springframework.remoting.rmi;

import java.rmi.RemoteException;

import org.apache.log4j.Logger;
import org.springframework.remoting.rmi.RmiServiceExporter;

public class RegisterHostIPExtendsServiceExproter extends RmiServiceExporter{
	  private Logger logger = Logger.getLogger(RegisterHostIPExtendsServiceExproter.class);
	  private String serverHost = "";

	  public String getServerHost()
	  {
	    return this.serverHost;
	  }

	  public void setServerHost(String serverHost) {
	    this.serverHost = serverHost;
	  }

	  public void afterPropertiesSet() throws RemoteException
	  {
	    if (!"".equals(this.serverHost)) {
	      System.setProperty("java.rmi.server.hostname", this.serverHost);
	      logger.info("register java.rmi.server.hostname is : " + this.serverHost);
	    }
	    prepare();
	  }
}
